package com.aidex.system.controller;

import java.util.List;
import com.aidex.common.annotation.Log;
import com.aidex.common.core.domain.R;
import com.github.pagehelper.PageInfo;
import com.aidex.common.core.page.PageDomain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aidex.common.enums.BusinessType;
import com.aidex.common.utils.poi.ExcelUtil;
import javax.validation.constraints.*;
import org.springframework.web.bind.annotation.*;
import com.aidex.common.core.controller.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import com.aidex.system.domain.VInternationalUnpacking;
import com.aidex.system.service.VInternationalUnpackingService;

/**
 * 国际开箱数据Controller
 * @author wll
 * @email wll
 * @date 2021-10-14
 */
@RestController
@RequestMapping("/system/vInternationalUnpacking")
public class VInternationalUnpackingController extends BaseController
{
    @Autowired
    private VInternationalUnpackingService vInternationalUnpackingService;

    /**
     * 查询国际开箱数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:list')")
    @GetMapping("/list")
    public R<PageInfo> list(VInternationalUnpacking vInternationalUnpacking, HttpServletRequest request, HttpServletResponse response)
    {
        vInternationalUnpacking.setPage(new PageDomain(request, response));
        return R.data(vInternationalUnpackingService.findPage(vInternationalUnpacking));
    }

    /**
     * 获取国际开箱数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:query')")
    @GetMapping(value = "/{id}")
    public R<VInternationalUnpacking> detail(@PathVariable("id") String id)
    {
        return R.data(vInternationalUnpackingService.get(id));
    }

    /**
     * 新增国际开箱数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:add')")
    @Log(title = "国际开箱数据", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody @Validated  VInternationalUnpacking vInternationalUnpacking)
    {
        return R.status(vInternationalUnpackingService.save(vInternationalUnpacking));
    }

    /**
     * 修改国际开箱数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:edit')")
    @Log(title = "国际开箱数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public R edit(@RequestBody @Validated VInternationalUnpacking vInternationalUnpacking)
    {
        return R.status(vInternationalUnpackingService.save(vInternationalUnpacking));
    }


    /**
     * 删除国际开箱数据
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:remove')")
    @Log(title = "国际开箱数据", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R remove(@PathVariable String[] ids)
    {
        return R.status(vInternationalUnpackingService.deleteVInternationalUnpackingByIds(ids));
    }


    /**
     * 导出国际开箱数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:vInternationalUnpacking:export')")
    @Log(title = "国际开箱数据", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public R export(VInternationalUnpacking vInternationalUnpacking)
    {
        List<VInternationalUnpacking> list = vInternationalUnpackingService.findList(vInternationalUnpacking);
        ExcelUtil<VInternationalUnpacking> util = new ExcelUtil<VInternationalUnpacking>(VInternationalUnpacking.class);
        return util.exportExcel(list, "vInternationalUnpacking");
    }

}
